package cn.lili.controller.feign.wechat;

import cn.hutool.json.JSONObject;
import cn.lili.common.enums.ClientTypeEnum;
import cn.lili.modules.goods.entity.dos.Commodity;
import cn.lili.modules.goods.entity.dos.Studio;
import cn.lili.modules.wechat.client.WechatClient;
import cn.lili.modules.wechat.entity.params.WechatParams;
import cn.lili.modules.wechat.util.WechatAccessTokenUtil;
import cn.lili.modules.wechat.util.WechatLivePlayerUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * SettingFeignController
 *
 * @author Chopper
 * @version v1.0
 * 2021-11-08 11:47
 */
@RestController
@RequiredArgsConstructor
public class WechatFeignController implements WechatClient {

    private final WechatAccessTokenUtil wechatAccessTokenUtil;

    private final WechatLivePlayerUtil wechatLivePlayerUtil;

    @Override
    public String cgiAccessToken(String clientTypeEnum) {
        return wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.valueOf(clientTypeEnum));
    }

    @Override
    public void removeAccessToken(String clientTypeEnum) {
        wechatAccessTokenUtil.removeAccessToken(ClientTypeEnum.valueOf(clientTypeEnum));
    }

    @Override
    public JSONObject addGoods(Commodity commodity) {
        return wechatLivePlayerUtil.addGoods(commodity);
    }

    @Override
    public JSONObject deleteGoods(String goodsId) {
        return wechatLivePlayerUtil.deleteGoods(goodsId);
    }

    @Override
    public JSONObject getGoodsWareHouse(List<String> goodsIdList) {
        return wechatLivePlayerUtil.getGoodsWareHouse(goodsIdList);
    }

    @Override
    public Boolean goodsDeleteInRoom(WechatParams wechatParams) {
        return wechatLivePlayerUtil.goodsDeleteInRoom(wechatParams.getRoomId(),wechatParams.getGoodsId());
    }

    @Override
    public Map<String, String> create(Studio studio) {
        return wechatLivePlayerUtil.create(studio);
    }

    @Override
    public void editRoom(Studio studio) {
        wechatLivePlayerUtil.editRoom(studio);
    }

    @Override
    public String getLiveInfo(Integer roomId) {
        return wechatLivePlayerUtil.getLiveInfo(roomId);
    }

    @Override
    public Boolean pushGoods(WechatParams wechatParams) {
        return wechatLivePlayerUtil.pushGoods(wechatParams.getRoomId(),wechatParams.getGoodsId());
    }
}
